package pages.common
{
    import mx.collections.ArrayCollection; 
	[Bindable]
  	[RemoteClass(alias="com.beilang.base.pagination.PaginationHelper")]
	public class PaginationHelper
	{
		public function PaginationHelper()
		{
			this.start=0;
			this.objectPerPage=10;
			this.sortDir="DESC";
		}

		public var sortField:String;

		public var sortDir:String;

		public var start:Number;

		public var objectPerPage:Number;
		
		public var list:ArrayCollection;
		
		public var totalSize:Number;
		
		public function getTotalPage():Number {
			var n:Number= Number(Math.ceil(totalSize / objectPerPage));
			if(n==0)n=1;
			return n;
		}
		
		public function getCurrentPage():Number {
			return Number(Math.ceil(start / objectPerPage)+1);
		}		
		
		public function getEnd():Number {
			return start+objectPerPage>totalSize?totalSize:start+objectPerPage;
		}
		
	}
}